<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_CreateTable_File extends CI_Migration
{
    public function up()
    {
        $this->dbforge->add_field('id');
        $this->dbforge->add_field(array(
            'name'    => array('type' => 'VARCHAR', 'constraint' => '100',),
            'hash'    => array('type' => 'VARCHAR', 'constraint' => '60',),
            'type'    => array('type' => 'VARCHAR', 'constraint' => '50',),
            'size'    => array('type' => 'INT',),
            'url'     => array('type' => 'TEXT',),
            'time'    => array('type' => 'DATETIME',),
            'user_id' => array('type' => 'INT', 'constraint' => '9',),
        ));
        $this->dbforge->add_key('hash');
        $this->dbforge->create_table('file');
    }

    public function down()
    {
        $this->dbforge->drop_table('file');
    }
} 